home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-23 | 2.0 KB | 89 lines | [TEXT/KAHL] |
- // Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
-
- #include "mtb.h"
-
- void main (void)
- {
- WindowPtr aWindow;
- Rect windowRect;
- Rect movieBox;
- Movie aMovie;
- Boolean done = false;
- OSErr err;
- EventRecord theEvent;
- WindowPtr whichWindow;
- short part;
-
- InitGraf (&qd.thePort);
- InitFonts ();
- InitWindows ();
- InitMenus ();
- TEInit ();
- InitDialogs (nil);
-
- if (!IsQuickTimeInstalled()) {
- CheckError(-1,"\pPlease install QuickTime and try again.");
- }
-
- err = EnterMovies ();
- if (err) return;
-
- SetRect (&windowRect, 100, 100, 200, 200);
- aWindow = NewCWindow (nil, &windowRect, "\pMovie",
- false, noGrowDocProc, (WindowPtr)-1,
- true, 0);
-
- SetPort (aWindow);
- aMovie = GetMovie ();
- if (aMovie == nil) return;
-
- GetMovieBox (aMovie, &movieBox);
- OffsetRect (&movieBox, -movieBox.left, -movieBox.top);
- SetMovieBox (aMovie, &movieBox);
-
- SizeWindow (aWindow, movieBox.right, movieBox.bottom, true);
- ShowWindow (aWindow);
-
- SetMovieGWorld (aMovie, (CGrafPtr)aWindow, nil);
-
- StartMovie (aMovie);
-
- while ( !IsMovieDone(aMovie) && !done ) {
- if (WaitNextEvent (everyEvent, &theEvent, 0, nil)) {
- switch ( theEvent.what ) {
- case updateEvt:
- whichWindow = (WindowPtr)theEvent.message;
- if (whichWindow == aWindow) {
- BeginUpdate (whichWindow);
- UpdateMovie(aMovie);
- SetPort (whichWindow);
- EraseRect (&whichWindow->portRect);
- EndUpdate (whichWindow);
- }
- break;
-
- case mouseDown:
- part = FindWindow (theEvent.where,
- &whichWindow);
- if (whichWindow == aWindow) {
- switch (part) {
- case inGoAway:
- done = TrackGoAway (whichWindow,
- theEvent.where);
- break;
- case inDrag:
- DragWindow (whichWindow,
- theEvent.where,
- &qd.screenBits.bounds);
- break;
- }
- }
- break;
- }
- }
- MoviesTask (aMovie, DoTheRightThing);
- }
- DisposeMovie (aMovie);
- DisposeWindow (aWindow);
- }
-